package com.uliian.upyundemo.dto;

import com.google.gson.annotations.SerializedName;

public class UpyunPolicy {
    public enum UpyunSaveKey{
        Date,
        FileMd5,
        Random16,
        Random32,
        FileName
    }
    public UpyunPolicy(String bucket, UpyunSaveKey saveKey, int expiration) {
        this.bucket = bucket;
        this.expiration = expiration;

        switch (saveKey){
            case Date:
                this.saveKey = "/{year}{mon}{day}{hour}{min}{sec}";
                break;
            case FileName:
                this.saveKey = "/{filename}{suffix}{.suffix}";
                break;
            default:
                this.saveKey ="/{"+ saveKey.toString().toLowerCase()+"}";
        }
    }

    public UpyunPolicy(String bucket, String saveKey, int expiration) {
        this.bucket = bucket;
        this.saveKey = "/"+saveKey;
        this.expiration = expiration;
    }

    private String bucket;
    @SerializedName("save-key")private String saveKey;
    private int expiration;
    private String date;
    @SerializedName("content-md5")private String contentMd5;
    @SerializedName("return-url")private String returnUrl;
    @SerializedName("notify-url")private String notifyUrl;
    @SerializedName("content-secret")private String contentSecret;
    @SerializedName("content-type")private String contentType;
    @SerializedName("allow-file-type")private String allowFileType;
    //@SerializedName("content-length-range")private Integer contentLengthRanget;
    @SerializedName("image-width-range")private String imageWidthRange;
    @SerializedName("image-height-range")private String imageHeightRange;
    @SerializedName("x-gmkerl-thumb")private String xGmkerlThumb;
    @SerializedName("x-gmkerl-type")private String xGmkerlType;
    //private String apps
    //@SerializedName("x-upyun-meta-ttl")private Integer xUpyunMetaTtl;

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public String getSaveKey() {
        return saveKey;
    }

    public void setSaveKey(String saveKey) {
        this.saveKey = saveKey;
    }

    public int getExpiration() {
        return expiration;
    }

    public void setExpiration(int expiration) {
        this.expiration = expiration;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getContentMd5() {
        return contentMd5;
    }

    public void setContentMd5(String contentMd5) {
        this.contentMd5 = contentMd5;
    }

    public String getReturnUrl() {
        return returnUrl;
    }

    public void setReturnUrl(String returnUrl) {
        this.returnUrl = returnUrl;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getContentSecret() {
        return contentSecret;
    }

    public void setContentSecret(String contentSecret) {
        this.contentSecret = contentSecret;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getAllowFileType() {
        return allowFileType;
    }

    public void setAllowFileType(String allowFileType) {
        this.allowFileType = allowFileType;
    }
//
//    public int getContentLengthRanget() {
//        return contentLengthRanget;
//    }
//
//    public void setContentLengthRanget(int contentLengthRanget) {
//        this.contentLengthRanget = contentLengthRanget;
//    }

    public String getImageWidthRange() {
        return imageWidthRange;
    }

    public void setImageWidthRange(String imageWidthRange) {
        this.imageWidthRange = imageWidthRange;
    }

    public String getImageHeightRange() {
        return imageHeightRange;
    }

    public void setImageHeightRange(String imageHeightRange) {
        this.imageHeightRange = imageHeightRange;
    }

    public String getxGmkerlThumb() {
        return xGmkerlThumb;
    }

    public void setxGmkerlThumb(String xGmkerlThumb) {
        this.xGmkerlThumb = xGmkerlThumb;
    }

    public String getxGmkerlType() {
        return xGmkerlType;
    }

    public void setxGmkerlType(String xGmkerlType) {
        this.xGmkerlType = xGmkerlType;
    }}
//
//    public int getxUpyunMetaTtl() {
//        return xUpyunMetaTtl;
//    }
//
//    public void setxUpyunMetaTtl(int xUpyunMetaTtl) {
//        this.xUpyunMetaTtl = xUpyunMetaTtl;
//    }
//}
